﻿@model IEnumerable<PessModel.Registration>

@{
    ViewBag.Title = "Registration List";
    int count = 0;    
}

<h2>Registration List</h2>
<h3>Paid registration: @Model.Count(r=>r.Status==1)</h3>
<p>

</p>
<table id="fileList" class="oddTable">
    <tr>
        <th>
            #
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PayId)
        </th>
        <th>
            Name
        </th>
        <th>
            Email
        </th>
<th>Affiliation</th>
        <th>
            Country
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Preference)
        </th>
        
        <th>
            @Html.DisplayNameFor(model => model.Status)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PayerName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Amount)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Paid)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Refund)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.OverTime)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PayType)
        </th>
        @*<th>
            @Html.DisplayNameFor(model => model.PayPassword)
        </th>*@
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        MembershipUser user = Membership.GetUser(item.UserId);
        System.Web.Profile.ProfileBase profile = System.Web.Profile.ProfileBase.Create(user.UserName);
        PessMvc.Models.UserModel usermodel = new PessMvc.Models.UserModel() { UserName = user.UserName };
        usermodel.FirstName = profile["FirstName"] == null ? "" : profile["FirstName"].ToString();
        usermodel.LastName = profile["LastName"] == null ? "" : profile["LastName"].ToString();
        usermodel.PhoneNumber = profile["PhoneNumber"] == null ? "" : profile["PhoneNumber"].ToString();
        usermodel.SchoolName = profile["Organization"] == null ? "" : profile["Organization"].ToString();
        usermodel.ZipCode = profile["ZipCode"] == null ? "" : profile["ZipCode"].ToString();
        usermodel.StateProvince = profile["StateProvince"] == null ? "" : profile["StateProvince"].ToString();
        usermodel.Country = profile["Country"] == null ? "" : profile["Country"].ToString();
        usermodel.City = profile["City"] == null ? "" : profile["City"].ToString();
        usermodel.Address1 = profile["Address1"] == null ? "" : profile["Address1"].ToString();
        usermodel.Address2 = profile["Address2"] == null ? "" : profile["Address2"].ToString();
        usermodel.ProfessionalTitle = profile["ProfessionalTitle"] == null ? "" : profile["ProfessionalTitle"].ToString();
        usermodel.Email = user.Email;
        usermodel.Fax = profile["Fax"] == null ? "" : profile["Fax"].ToString();
        
        <tr>
            <td>
                @(++count)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PayId)
            </td>
            <td>
                @(usermodel.FirstName+ " " +usermodel.LastName)
            </td>
            <td>
                @usermodel.Email
            </td>
<td>@usermodel.SchoolName</td>
            <td>
                @usermodel.Country
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Preference)
            </td>
            
            <td>
                @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PayerName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Amount)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Paid)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Refund)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.OverTime)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PayType)
            </td>
            @*<td>
                @Html.DisplayFor(modelItem => item.PayPassword)
            </td>*@
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.UserId }) |
                @Html.ActionLink("Details", "Details", new { id = item.UserId }) |
    @Html.ActionLink("Delete", "Delete", new { id = item.UserId })
            </td>
        </tr>
    }

</table>
